function MarkdownConvert() {
    this.init()
}
(function () {
    MarkdownConvert.prototype = {
        editor: dialog.editor,
        html: '',
        converter_html: '',
        init() {
            var me = this;
            me.html = me.editor.getContent()
            $G('beforeContent').innerHTML = me.html
            $G('beforeContent').style.display = 'block'
            domUtils.on($G("J_transformBtn"), "click", function () {
                me._transform()
            })
        },
        _transform() {
            const turndownService = new TurndownService()
            // turndownService.addRule('strikethrough', {
            //     filter: ['li.list-cn-1-1', 'style ', 'strike'],
            //     replacement: function (content) {
            //       return '~' + content + '~'
            //     }
            // })
            const _markdown = turndownService.turndown(this.html)
            showdown.setOption('simpleLineBreaks', true)
            const converter = new showdown.Converter
            this.converter_html = converter.makeHtml(_markdown)
            $G('afterContent').innerHTML = this.converter_html
            $G('afterContent').style.display = 'block'
        },
        exec:function () {
            $G('beforeContent').innerHTML = ''
            $G('afterContent').innerHTML = ''
            editor.setOpt('enterTag', '')
            editor.execCommand('cleardoc')
            editor.execCommand('inserthtml', this.converter_html)
        }
    }
})()



